<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>登录</title>
    <link rel="stylesheet" href="/static/libs/layui-v2.5.5/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/login.css">
    <script src="/static/libs/jquery/jquery.min.js"></script>
    <style>
        html{height:100%;}
        body{height:100%;position:relative;background:url("/static/admin/images/login-bg.jpg") no-repeat; background-size:cover; }
    </style>


</head>
<body>
<div class="login-wrap">
    <div class="login-main">
    <div class="login-hd">管理系统</div>
        <div class="layui-form" >
            <div class="layui-form-item">
                <div class="layui-input-inline login-item">
                    <label class="login-label">账号</label>
                    <input onfocus="this.type='text'" class="layui-input" name="username" lay-verify="required" autocomplete="off" placeholder="账号"/>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline login-item">
                    <label class="login-label">密码</label>
                    <input onfocus="this.type='password'" class="layui-input" name="password" lay-verify="required" autocomplete="off" placeholder="密码"/>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline login-btn">
                    <button class="layui-btn" lay-submit lay-filter="login">登录</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/libs/layui-v2.5.5/layui/layui.js"></script>
<script src="/static/admin/js/global.js"></script>
<script>
    window.onload = function() {
        if (top.location.href != location.href){
            top.location.href = location.href
        }
    };
    layui.use(['element', 'layer', 'jquery','form'], function() {
          var $ = layui.jquery,
              element = layui.element,
              layer = layui.layer,
              form=layui.form;

       //获取光标
        $(".login-main .login-item").click(function(e) {
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        });
        $(".login-main .login-item .layui-input").focus(function() {
            $(this).parent().addClass("layui-input-focus");
        });
        $(".login-main .login-item .layui-input").blur(function() {
            $(this).parent().removeClass("layui-input-focus");
            if ($(this).val() != '') {
                $(this).parent().addClass("layui-input-active");
            } else {
                $(this).parent().removeClass("layui-input-active");
            }
        });
        //登录
        form.on('submit(login)', function(data){
            ajax("{:url('login/save')}",data.field,'post',"{:url('main/index')}");
        });

    })
</script>
</body>
</html>